package com.ymatou.app.seller.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.seller.parameter.CreateActivity_V2Bean;
import com.ymatou.app.seller.service.CreateActivity_V2Call;

import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;

import com.ymttest.business.service.AuthCallService;
import com.ymttest.utils.YMTDateUtil;

/**
 * 发布直播活动
 */
@TestSuite
public class Ts_CreateActivity_V2 {
	private static CreateActivity_V2Bean createActivityBean;
	private static CreateActivity_V2Call createActivityCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("发布直播活动");
	}

	@Before
	public void caseUp() {
		createActivityBean = new CreateActivity_V2Bean();
		createActivityCall = new CreateActivity_V2Call();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(createActivityCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_createActivity_V2_001() {
		Logger.start(true,"创建直播活动成功");
		try {
			
			Map m=AuthCallService.authLogin("ukseller", "aabbcc");
			String AccessToken = (String) m.get("AccessToken");
			int UserId = 20123134;
			// 设置参数
			createActivityBean.setAccessToken(AccessToken);
			createActivityBean.setActivityContent("自动化测试TEST直播活动ActivityContent");
			createActivityBean.setActivityName("activityName");
			createActivityBean.setAppName("ukseller");
			createActivityBean.setBrands("asidas");
			createActivityBean.setCategoryId("10");
			createActivityBean.setCountryId(2);
			createActivityBean.setDelType(0);
			createActivityBean.setStartTime(YMTDateUtil.getBeforeOrNextSecond(3));
			//Logger.debug("ststime:"+DateUtil.getSysTime());
			createActivityBean.setEndTime(YMTDateUtil.getBeforeOrNextHour(5));
			createActivityBean.setMarketId("1153");
			createActivityBean.setPicUrl("http://pc1.img.ymatou.com/G01/M00/09/B1/rBBlD1aWDK6AcJeTAAAIWScWAic788_c.jpg");
			createActivityBean.setPosition("中国上海市闸北区大宁路街道永和路187号");
			createActivityBean.setUserId(UserId);
			// 发送数据
			createActivityCall.setData(createActivityBean);
			createActivityCall.callService();
			Logger.comment("createActivitycall send:" + createActivityCall.getEntityString());
			Logger.comment("createActivitycall response:" + createActivityCall.getReturnData());
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}